Make ostree admin --help output more useful
authorMatthias Clasen <mclasen@redhat.com>
Sun, 30 Sep 2012 16:18:50 +0000 (12:18 -0400)
committerColin Walters <walters@verbum.org>
Mon, 22 Oct 2012 22:10:56 +0000 (18:10 -0400)
At a minimum, it should list the available subcommands. This is
still not perfect, since there is no way to get at the help output
of the subcommands - getting that right needs more refactoring.

Signed-off-by: Colin Walters <walters@verbum.org>
src/libgsystem
src/ostree/ot-builtin-admin.c

index c6b949b3ddd1c214db15a31ccdbdff70aa01fa26..9f0342c586f8084991ccd7b888dba720bc929be8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c6b949b3ddd1c214db15a31ccdbdff70aa01fa26
+Subproject commit 9f0342c586f8084991ccd7b888dba720bc929be8
index 54f2829b81582b2debf76a0be5c0497fe12e6f82..000e09178540af85bb8130433db379a12fb0923f 100644 (file)
@@ -63,6 +63,20 @@ ostree_builtin_admin (int argc, char **argv, GFile *repo_path, GError **error)
   ot_lobj GFile *ostree_dir = NULL;
 
   context = g_option_context_new ("[OPTIONS] SUBCOMMAND - Run an administrative subcommand");
+
+  {
+    GString *s = g_string_new ("Subcommands:\n");
+
+    subcommand = admin_subcommands;
+    while (subcommand->name)
+      {
+        g_string_append_printf (s, "  %s\n", subcommand->name);
+        subcommand++;
+      }
+    g_option_context_set_description (context, s->str);
+    g_string_free (s, TRUE);
+  }
+    
   g_option_context_add_main_entries (context, options, NULL);
   /* Skip subcommand options */
   g_option_context_set_ignore_unknown_options (context, TRUE);